package com.example.stars_project_android;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.example.stars_project_android.login.Login;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMOptions;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;

/**
 * 刚进入的界面
 */
public class MainActivity extends AppCompatActivity {

    //设置属性
    private TextView currTime;  //显示当前时间
    private int hour;
    private int minute;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        //获取当前时间，只显示时分
//        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
        Calendar calendar = Calendar.getInstance();
        hour = calendar.get(Calendar.HOUR_OF_DAY);
//分钟
        minute = calendar.get(Calendar.MINUTE);

        currTime = findViewById(R.id.text_currTime);
        currTime.setText(hour+"："+minute);

        //定时5秒后跳转到登陆页面
        final Intent itent = new Intent(this, Login.class); //你要转向的Activity
        Timer timer = new Timer();
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                startActivity(itent); //执行
            }
        };
        timer.schedule(task, 1000 * 3); //5秒后
    }



}